<template>
	<view class="content">
		<view class="Box" v-if="simpleInfoList.length!=0">
			<view class="simpleInfo" v-for="item,index in simpleInfoList" :key="index" @click="checkUser(item.uid)">
				<view class="UserInfo">
					<view class="Avatar">
						<!-- <image :src="'http://cdn.gdxywsw.club/' + avatar" /> -->
						<image :src="'http://cdn.gdxywsw.club/' + item.avatar"></image>
					</view>
					<view>
						<view class="Nickname">{{item.nickname}}</view>
						<view class="Description">{{item.description}}</view>
					</view>
				</view>
				<view class="Buttons">
					<button type="warn" size="mini" v-if="item.subscribe == 1 && item.fan == 0">你的关注</button>
					<button type="primary" size="mini" v-if="item.fan == 1 && item.subscribe == 0">你的粉丝</button>
					<button type="default" size="mini" v-if="item.subscribe == 1 && item.fan == 1">互相关注</button>
				</view>
			</view>
		</view>
		<view class="Box2" v-else>
			<view class="simpleInfo_no">
				<span v-show="checked==2">暂无关注</span>
				<span v-show="checked==3">暂无粉丝</span>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		name: "simpleUserInfo",
		props: {
			simpleInfoList: {
				type: Array,
				default: []
			},
			checked: {
				type: Number,
				default: 2
			}
		},
		data() {
			return {

			};
		},
		computed: {
			...mapState('my_Info', ['userInfo'])
		},
		methods: {
			checkUser(uid) {
				if (uid == this.userInfo.uid) {
					uni.switchTab({
						url: '../../pages/userInfo/userInfo'
					})
				} else {
					uni.navigateTo({
						url: '/subpkg/othersHome/othersHome?otherUid=' + encodeURIComponent(JSON.stringify(
							uid)),
					})
				}
			},
		}
	}
</script>

<style lang="less">
	.content {
		.Box {

			.simpleInfo {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin: 5px 8px;
				padding: 5px;
				border-radius: 5px;
				background-color: rgb(255, 255, 255);

				.UserInfo {
					display: flex;

					.Avatar image {
						width: 40px;
						height: 40px;
						border-radius: 40px;
						border: 1px solid #e1e4e6;
					}

					.Nickname {
						margin-top: 2px;
						margin-left: 5px;
						font-weight: bolder;
					}

					.Description {
						margin-top: 3px;
						font-size: 13px;
						margin-left: 5px;
					}
				}


			}

		}

		.Box2 {


			.simpleInfo_no {
				display: flex;
				justify-content: center;
				align-items: center;

				width: 100%;
				height: 174px;
				background: url('@/static/images/custom-empty-image.png') no-repeat;
				background-size: 15%;
				background-position: 50% 50%;
				color: #bfbfbf;

				span {
					margin-top: 82px;
				}
			}
		}



	}
</style>
